const path = require('path');
let pathStr = path.join(__dirname,'./test.txt');

// 获得最后一个文件名.扩展名
let filelast = path.basename(pathStr);
console.log(filelast);

//获得扩展名
let last = path.extname(pathStr);
console.log(last);

//去掉扩展名
let clearLast = path.basename(pathStr,last);
console.log(clearLast);

